<?php if(!defined('WANYA_ROOT')) {exit('error!');}?>
<div class=containertitle><b>学生管理</b>
<?php if(isset($_GET['active_del'])):?><span class="actived">删除学生成功</span><?php endif;?>
	<?php if(isset($_GET['active_update'])):?><span class="actived">编辑学生资料成功</span><?php endif;?>
	<?php if(isset($_GET['active_add'])):?><span class="actived">添加学生成功</span><?php endif;?>
</div>
<div class=line></div>

<form action="student_list.php" method="post" name="form_student" id="form_student">
	<fieldset style="border:2px solid #0099ff;">
		<legend>检索条件</legend>
		<table style="margin-bottom: 5px;margin-left: 10px">
		<tr>
			<td>电话：</td>
			<td>
				<input type="text" name="tel" value="<?php echo($tel);?>">
			</td>
			<td width="20px"></td>
			<td>
				<input type="button" value="检索" class="button" onclick="commitSelect();">
			</td>
			<td width="60px"></td>
			<td>
				<input type="button" value="添加" class="button" onclick="commitAdd();">
			</td>
			<td width="20px"></td>
			<td>
				<input type="button" value="用户→学生" class="button" onclick="userToStudent();">
			</td>
		</tr>
	</table>
	</fieldset>
	<br>
  <table width="100%" id="adm_comment_list" class="item_list">
  	<thead>
      <tr>
	<th width="50" colspan="1"><b>选择</b></th>
        <th width="200" colspan="1"><b>姓名</b></th>
		<th width="150"><b>电话</b></th>
		  <th width="100"><b>性别</b></th>
		  <th width="300"><b>出生年月</b></th>
		  <th width="300"><b>家长姓名</b></th>
		  <th width="200"><b>家长电话1</b></th>
		  <th width="200"><b>家长电话2</b></th>
		<th width="400"><b>注册时间</b></th>
        <th width="150"><b>操作</b></th>
      </tr>
    </thead>
    <tbody>
	<?php
	if($students):
	foreach($students as $key=>$value):
	?>
     <tr>
		<td><input type="checkbox" value="<?php echo $value['ID']; ?>" name="ids[]" class="ids" /></td>
		<td><?php echo $value['name']; ?></td>
 		<td><?php echo $value['tel']; ?></td>
		<td><?php echo $value['sex']==1?"男":"女"; ?></td>
		<td><?php echo $value['birthday']; ?></td>
		<td><?php echo $value['parent_name']; ?></td>
		<td><?php echo $value['parent_tel1']; ?></td>
		<td><?php echo $value['parent_tel2']; ?></td>
		<td><?php echo $value['buildtime']; ?></td>
 		<td><input type="button" value="编辑" onclick="commitUpdate('<?php echo $value['ID']; ?>');"></td>
	<?php endforeach;else:?>
	  <tr><td class="tdcenter" colspan="4">还没有学生信息</td></tr>
	<?php endif;?>
	</tbody>
  </table>
	<div class="list_footer">
	<a href="javascript:void(0);" id="select_all">全选</a> 选中项：
    <a href="javascript:commitDel();" class="care">删除</a>
	<input name="action" id="action" value="" type="hidden" />	<input name="ID" id="ID" value="" type="hidden" />
	</div>
    <div class="page"><?php echo $pageurl; ?> (共有<?php echo $usersNum; ?>位学生)</div>
</form>
<script>
$(document).ready(function(){
	$("#select_all").toggle(function () {$(".ids").attr("checked", "checked");},function () {$(".ids").removeAttr("checked");});
	$("#adm_comment_list tbody tr:odd").addClass("tralt_b");
	$("#adm_comment_list tbody tr")
		.mouseover(function(){$(this).addClass("trover");$(this).find("span").show();})
		.mouseout(function(){$(this).removeClass("trover");$(this).find("span").hide();})
});
setTimeout(hideActived,2600);
function commitDel(){
	if (getChecked('ids') == false) {
		alert('请选择要删除的学生');
		return;
	}
	if(!confirm('你确定要删除所选学生吗？')){return;}
	$("#action").val("delete");
	$("#form_student").submit();
}
function commitSelect(){
	$("#form_student").submit();
}
function commitUpdate(id){
	$("#ID").val(id);
	$("#action").val("update");
	$("#form_student").submit();
}
function commitAdd(){
	$("#action").val("add");
	$("#form_student").submit();
}
function userToStudent(){
	$("#action").val("userToStudent");
	$("#form_student").submit();
}
$("#menu_cm").addClass('sidebarsubmenu1');
</script>